<script setup lang="ts">
import { ref } from 'vue'
import my_SonCom from './components/my_SonCom.vue'

const fName = ref('小白')
const fMoney = ref(1000)

const changeMoney = (money: number) => {
  console.log('子组件触发父组件事件' + money)
  // 修改父组件的数据
  fMoney.value += money
}
</script>

<template>
  <div>
    <h2>父组件</h2>
    <!-- 子传父 -->
    <!-- 第二步：在父组件中调用 -->
    <my_SonCom :name="fName" :money="fMoney" @change-money="changeMoney"></my_SonCom>
  </div>
</template>

<style scoped></style>
